<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>橡树科技－JavaDemoSystem</title>
    <script src="/js/jquery-1.12.4.js"></script>
    <link type="text/css" rel="stylesheet" media="all" href="/static/styles/global.css"/>
    <link type="text/css" rel="stylesheet" media="all" href="/static/styles/global_color.css"/>
    <script language="javascript" type="text/javascript">
        //删除
        function deleteAccount(date1) {
            //删除提示
            var r = window.confirm("确定要删除此账务账号吗？\r\n删除后将不能恢复，且会删除其下属的所有业务账号。");
            //获取要删除的账务id
            var delAccountId = date1.valueOf();
            //发送请求
            $.get("/account/account_deleteAccount?accountId="+delAccountId);
            setTimeout("window.location.reload()",1500);
            document.getElementById("operate_result_info").style.display = "block";
        }

        //开通
        function setState(date1) {
            var r = window.confirm("确定要暂停此账务账号吗？");
            var statusState =  document.getElementById("statusState").value;
            var accountId = date1.valueOf();
            $.get("/account/account_update?status=" + statusState+"&accountId="+accountId);
            // location.reload();
            setTimeout("window.location.reload()",1500);
        }
        //暂停
        function setStop(date1) {
            var r = window.confirm("确定要开通此账务账号吗？");
            var statusStop =  document.getElementById("statusStop").value;
            var accountId = date1.valueOf();
            $.get("/account/account_update?status=" + statusStop+"&accountId="+accountId);
            // location.reload();
            setTimeout("window.location.reload()",1500);
        }

        function status() {
            var btn_search = document.getElementsByClassName("btn_search");
            var status = document.getElementById("status");
            status = status.val();
            alert(status);
        }
    </script>
</head>
<body>

<div id="header">
    <img src="/static/images/logo.png" alt="logo" class="left"/>
    <a href="/logout">[退出]</a>
</div>


<div id="navi">
    <ul id="menu">
        <li><a href="../index.html" class="index_off"></a></li>
        <li><a href="../role/role_list.html" class="role_off"></a></li>
        <li><a href="../admin/admin_list.html" class="admin_off"></a></li>
        <li><a href="../fee/fee_list.html" class="fee_off"></a></li>
        <li><a href="/account/account_list" class="account_on"></a></li>
        <li><a href="../service/service_list.html" class="service_off"></a></li>
        <li><a href="../bill/bill_list.html" class="bill_off"></a></li>
        <li><a href="../report/report_list.html" class="report_off"></a></li>
        <li><a href="../user/user_info.html" class="information_off"></a></li>
        <li><a href="../user/user_modi_pwd.html" class="password_off"></a></li>
    </ul>
</div>


<div id="main">
    <%--<form action="" method="">--%>
        <div class="search_add">
            <div>身份证：<input type="text" value="不验证" class="text_search"/></div>
            <div>姓名：<input type="text" class="width70 text_search" value="不验证"/></div>
            <div>登录名：<input type="text" value="不验证" class="text_search"/></div>
            <form action="/account/account_select" method="get">
            <div>
                状态：
                    <select class="select_search" name="status" >
                        <option value="10">全部</option>
                        <option value="0">开通</option>
                        <option value="1">暂停</option>
                        <option value="2">删除</option>
                    </select>
            </div>
                <div><input type="submit" value="搜索" class="btn_search" /></div>
                <input type="button" value="增加" class="btn_add" onClick="location.href='account/account_add'"/>
        </form>
        </div>
        <!--删除等的操作提示-->
        <div id="operate_result_info" class="operate_success">
            <img src="/static/images/close.png" onClick="this.parentNode.style.display='none';"/>
            删除成功，且已删除其下属的业务账号！
        </div>
        <!--数据区域：用表格展示数据-->
        <div id="data">
            <table id="datalist">
                <tr>
                    <th>账号ID</th>
                    <th>姓名</th>
                    <th class="width150">身份证</th>
                    <th>登录名</th>
                    <th>状态</th>
                    <th class="width100">创建日期</th>
                    <th class="width150">上次登录时间</th>
                    <th class="width200">操作</th>
                </tr>
                <!--无数据时显示-->
                <span style="size: 50px; color: red;">${accountError}</span>
                <!--循环遍历数据-->
                <c:forEach items="${accountList.list}" var="account">
                    <tr>
                        <td>${account.accountId}</td>
                        <!--超链接跳转到详情页-->
                        <td><a href="/account/account_detail?accountId=${account.accountId}">${account.realName}</a></td>
                        <td>${account.idcardNo}</td>
                        <td>${account.loginName}</td>
                        <!--0已开通  1已暂停  2已删除 -->
                        <c:if test="${account.status == '0'}">
                            <td>开通</td>
                        </c:if>
                        <c:if test="${account.status == '1'}">
                            <td>暂停</td>
                        </c:if>
                        <c:if test="${account.status == '2'}">
                            <td>删除</td>
                        </c:if>
                        <!--格式化时间-->
                        <td><fmt:formatDate value="${account.createDate}" pattern="yyyy-MM-dd"/></td>
                        <td><fmt:formatDate value="${account.lastLoginTime}" pattern="yyyy-MM-dd HH:SS:ss"/></td>
                        <td class="td_modi">
                            <!--已删除时隐藏三个按钮-->
                            <c:if test="${account.status != '2'}">
                                <!--暂停,开通图标切换-->
                                <c:if test="${account.status == '0'}">
                                    <input type="button" value="暂停" id="statusState" class="btn_pause" onClick="setState(${account.accountId});"/>
                                </c:if>
                                <c:if test="${account.status == '1'}">
                                    <input type="button" value="开通" id="statusStop" class="btn_start" onClick="setStop(${account.accountId});"/>
                                </c:if>
                                <input type="button" value="修改" class="btn_modify" onClick="location.href='/account/account_updateAccount?accountId='+${account.accountId}"/>
                                <input type="button" value="删除" class="btn_delete" id="deleteAccount" onclick="deleteAccount(${account.accountId})"/>
                            </c:if>
                            <c:if test="${account.status == '2'}">
                               <!--状态为删除时不显示按钮-->
                            </c:if>
                        </td>
                    </tr>
                </c:forEach>
            </table>
            <!--分页-->
            <div id="pages">
                <!--总记录数大于10条时显示分页 否则不显示分页信息-->
                <c:if test="${accountList.total > 10}">
                    <a href="/account/account_list?page=1">首页</a>
                    <!--判断是否是第一页. 是: 显示当前页. 否: 当前页减一-->
                    <c:if test="${accountList.isFirstPage}">
                        <a href="/account/account_list?page=${accountList.pageNum}">上一页</a>
                    </c:if>
                    <c:if test="${!accountList.isFirstPage}">
                        <a href="/account/account_list?page=${accountList.pageNum - 1 }">上一页</a>
                    </c:if>
                    <!--循环显示页码-->
                    <c:forEach begin="1" end="${accountList.pages}" step="1" var="index">
                        <c:if test="${accountList.pageNum==index}">
                            <a class="current_page" href="/account/account_list?page=${index}">${index}</a>
                        </c:if>
                        <c:if test="${accountList.pageNum!=index}">
                            <a href="/account/account_list?page=${index}">${index}</a>
                        </c:if>
                    </c:forEach>
                    <!--判断是否是最后一页. 是: 显示当前页. 否: 当前页加一 -->
                    <c:if test="${accountList.isLastPage}">
                        <a href="/account/account_list?page=${accountList.pageNum}">下一页</a>
                    </c:if>
                    <c:if test="${!accountList.isLastPage}">
                        <a href="/account/account_list?page=${accountList.pageNum + 1 }">下一页</a>
                    </c:if>
                    <a href="/account/account_list?page=${accountList.pages}">末页</a>
                </c:if>
            </div>
            <p>业务说明：<br/>
                1、创建则开通，记载创建时间；<br/>
                2、暂停后，记载暂停时间；<br/>
                3、重新开通后，删除暂停时间；<br/>
                4、删除后，记载删除时间，标示为删除，不能再开通、修改、删除；<br/>
                5、暂停账务账号，同时暂停下属的所有业务账号；<br/>
                6、暂停后重新开通账务账号，并不同时开启下属的所有业务账号，需要在业务账号管理中单独开启；<br/>
                7、删除账务账号，同时删除下属的所有业务账号。</p>
        </div>
    <%--</form>--%>
</div>
<!--主要区域结束-->
<div id="footer">
    <p>[源自橡树的技术，最优秀的师资，最真实的企业环境，最适用的实战项目]</p>
    <p>版权所有(C)橡树信息科技有限公司 </p>
</div>
</body>
</html>
